package com.db.message;

import java.sql.*;
import java.util.*;
import java.io.*;

import javax.annotation.Resource;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.ibatis.common.resources.*;
import com.ibatis.sqlmap.client.*;

public class MessageDAO extends SqlMapClientDaoSupport implements InterMessage {

	public List sendAllData(String id) throws SQLException {

		return getSqlMapClientTemplate().queryForList("sendAllData", id);
	}

	public List recvAllData(String id) throws SQLException {

		return getSqlMapClientTemplate().queryForList("recvAllData", id);
	}

	public void msgSend(MessageVO vo) throws SQLException {
		getSqlMapClientTemplate().insert("msgSend", vo);
	}

	public MessageVO msgContentData(int no) throws SQLException {
		return (MessageVO) getSqlMapClientTemplate().queryForObject(
				"msgContentData", no);
	}

	public void msgSendDelete(int no) throws SQLException {
		getSqlMapClientTemplate().update("msgSendDelete", no);
	}

	public void msgRecvDelete(int no) throws SQLException {
		getSqlMapClientTemplate().update("msgRecvDelete", no);
	}

	public void allSendDelete(String send_id) throws SQLException {
		getSqlMapClientTemplate().update("allSendDelete", send_id);
	}

	public void allRecvDelete(String recv_id) throws SQLException {
		getSqlMapClientTemplate().update("allRecvDelete", recv_id);
	}

	public void msgAllDelete() throws SQLException {
		getSqlMapClientTemplate().delete("msgAllDelete");
	}

}
